<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.util.Vector,com.ejoysoft.wlanyz.business.Environment,com.ejoysoft.common.Constants,com.ejoysoft.common.exception.NoRightException" %>
<%@page import="sun.reflect.generics.tree.IntSignature"%>
<%@page import="com.ejoysoft.common.Format"%>
<%@ page import="java.util.List"%>
<%@ page import="org.openflashchart.Graph"%>
<%@ page import="org.openflashchart.Bar"%>
<%@page import="java.util.Random"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@ include file="../include/jsp/head.jsp"%>
<%@ page import="java.text.NumberFormat"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>

<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'regional_coverage.jsp' starting page</title>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.4"></script>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="../css/main.css" rel="stylesheet" type="text/css" />
	<script language="JavaScript" src="../include/date/popc.js"></script>
	<script src="../include/js/list.js"></script>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body>
  <%
  	String  paramters = ParamUtil.getString(request,"paramters","");
  	System.out.println("[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[paramters::"+paramters);
  	String params[] = paramters.split("_");
	//String strCity  = params[0];
	String strCity  = globa.city;
	String strStartTime = params[1];
	String strEndTime = params[2];
  	Environment Environment0 = null;
	Environment obj = new Environment(globa);
	String strTimeSql = " between to_date('" + strStartTime + "','yyyy-MM-dd hh24.mi.ss') and to_date('" + strEndTime + "','yyyy-MM-dd hh24.mi.ss')";
	//获取所有地市
	String where = "where 1=1 ";
	if(strCity !=null &&!strCity.equals("")){
		where += " and strCity = '" + strCity +"'";
	}
	where += " and DTCREATDATE " + strTimeSql;
	ArrayList<String> listcity = obj.returnCity(where);
	
	//NumberFormat nt = NumberFormat.getPercentInstance();
	Graph g = new Graph();
	Bar b = new Bar("50", "#9933CC");
	Bar b2 = new Bar("50", "#2843BB");
	Bar b3 = new Bar("50", "#1000AA");
	Bar b4= new Bar("50", "#6540CC");
	Bar b5 = new Bar("50", "#0937483");
	Bar b6 = new Bar("50", "#000564");
	Bar b7 = new Bar("50", "#999999");
	Bar b8 = new Bar("50", "#5433CC");
	Bar b9 = new Bar("50", "#4644df");
	Bar b10 = new Bar("50", "#445544");
	Bar b11= new Bar("50", "#9754KK");
	Bar b12 = new Bar("50", "#2843BB");
	Bar b13 = new Bar("50", "#1000AA");
	Bar b14= new Bar("50", "#6540CC");
	Bar b15 = new Bar("50", "#0937483");
	Bar b16 = new Bar("50", "#000564");
	Bar b17 = new Bar("50", "#999999");
	Bar b18 = new Bar("50", "#5433CC");
	Bar b19 = new Bar("50", "#4644df");
	Bar b20 = new Bar("50", "#445544");
	
	//b.key("AP关联成功次数", 15);
	//b2.key("AP关联总次数", 15);
	//b3.key("WEB认证成功次数", 15);
	//b4.key("WEB认证总次数", 15);
	//b5.key("WEB下线成功次数", 15);
	//b6.key("WEB下线总次数", 15);
	//b7.key("PEAP认证成功次数", 15);
	//b8.key("PEAP认证总次数", 15);
	//b9.key("PEAP下线成功次数", 15);
	//b10.key("PEAP下线总次数", 15);
	//b11.key("HTTP请求成功次数", 15);
	//b12.key("HTTP请求总次数", 15);
	//b13.key("FTP上行成功次数", 15);
	//b14.key("FTP上行总次数", 15);
	//b15.key("FTP下行成功次数", 15);
	//b16.key("FTP下行总次数", 15);
	//b17.key("用户隔离成功次数", 15);
	//b18.key("用户隔离总次数", 15);
	//b19.key("用户漫游成功次数", 15);
	//b20.key("用户漫游总次数", 15);
	
	List<String> links = new ArrayList<String>();
	//int max = 50;
	
	for(int i = 0;  i<listcity.size(); i++) {
		
		String where1 = "where a.strNetType= 'GSM'";
		Vector<Environment> vctObj = obj.returnindex(where1,listcity.get(i));
		double sun1=0,sun2=0,sun3=0,sun4=0,sun5=0,sun6=0,sun7=0,sun8=0,sun9=0,sun10=0,sun11=0,sun12=0,sun13=0,sun14=0,sun15=0,sun16=0,sun17=0,sun18=0,sun19=0,sun20=0;
		int intVct=(vctObj!=null&&vctObj.size()>0?vctObj.size():0);
		if(vctObj!=null){
    	for (int j = 0;j < vctObj.size(); j++) {
	    	Environment obj1 = vctObj.get(j);
	    	sun1+=obj1.getIntAp_Corr_Suc_Counts();
		    sun2+=obj1.getIntAp_Corr_Total_Counts();
		    sun3+=obj1.getIntWeb_Auth_Suc_Counts();
		    sun4+=obj1.getIntWeb_Auth_Total_Counts();
		    sun5+=obj1.getIntWeb_Off_Suc_Counts();
		    sun6+=obj1.getIntWeb_Off_Total_Counts();
		    sun7+=obj1.getIntPeap_Auth_Suc_Counts();
		    sun8+=obj1.getIntPeap_Auth_Total_Counts();		    
		    sun9+=obj1.getIntPeap_Off_Suc_Counts();
		    sun10+=obj1.getIntPeap_Off_Total_Counts();
		    sun11+=obj1.getIntHttp_Req_Suc_Counts();
		    sun12+=obj1.getIntHttp_Req_Total_Counts();
		    sun13+=obj1.getIntFtp_Up_Suc_Counts();
		    sun14+=obj1.getIntFtp_Up_Total_Counts();
		    sun15+=obj1.getIntFtp_Down_Suc_Counts();
		    sun16+=obj1.getIntFtp_Down_Total_Counts();
		    sun17+=obj1.getIntUser_Seg_Suc_Counts();
		    sun18+=obj1.getIntUser_Seg_Total_Counts();		    
		    sun19+=obj1.getIntUser_Roam_Suc_Counts();
		    sun20+=obj1.getIntUser_Roam_Total_Counts();
    	
    	}}
		sun1=sun1/intVct;
		sun2=sun2/intVct;
		sun3=sun3/intVct;
		sun4=sun4/intVct;
		sun5=sun5/intVct;
		sun6=sun6/intVct;
		sun7=sun7/intVct;
		sun8=sun8/intVct;
		sun9=sun9/intVct;
		sun10=sun10/intVct;
		sun11=sun11/intVct;
		sun12=sun12/intVct;
		sun13=sun13/intVct;
		sun14=sun14/intVct;
		sun15=sun15/intVct;
		sun16=sun16/intVct;
		sun17=sun17/intVct;
		sun18=sun18/intVct;
		sun19=sun19/intVct;
		sun20=sun20/intVct;
		
		b.add(Double.toString(sun1),"");
		b2.add(Double.toString(sun2),"");
		b3.add(Double.toString(sun3),"");
		b4.add(Double.toString(sun4),"");
		b5.add(Double.toString(sun5),"");
		b6.add(Double.toString(sun6),"");
		b7.add(Double.toString(sun7),"");
		b8.add(Double.toString(sun8),"");
		b9.add(Double.toString(sun9),"");
		b10.add(Double.toString(sun10),"");
		b11.add(Double.toString(sun11),"");
		b12.add(Double.toString(sun12),"");
		b13.add(Double.toString(sun13),"");
		b14.add(Double.toString(sun14),"");
		b15.add(Double.toString(sun15),"");
		b16.add(Double.toString(sun16),"");
		b17.add(Double.toString(sun17),"");
		b18.add(Double.toString(sun18),"");
		b19.add(Double.toString(sun19),"");
		b20.add(Double.toString(sun20),"");
	}
	
	//小数点后面最多显示几位
	//nt.setMinimumFractionDigits(3);
	
	// Spoon sales, March 2007
	g.title("地市相关测试次数图形展示", "{font-size: 26px;}");
	g.getData_sets().add(b);
	g.getData_sets().add(b2);
	g.getData_sets().add(b3);
	g.getData_sets().add(b4);
	g.getData_sets().add(b5);
	g.getData_sets().add(b6);
	g.getData_sets().add(b7);
	g.getData_sets().add(b8);
	g.getData_sets().add(b9);
	g.getData_sets().add(b10);
	g.getData_sets().add(b11);
	g.getData_sets().add(b12);
	g.getData_sets().add(b13);
	g.getData_sets().add(b14);
	g.getData_sets().add(b15);
	g.getData_sets().add(b16);
	g.getData_sets().add(b17);
	g.getData_sets().add(b18);
	g.getData_sets().add(b19);
	g.getData_sets().add(b20);
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	// label each point with its value
	
	List<String> labels = new ArrayList<String>();
	for(int i=0;i<listcity.size();i++){
	
		labels.add(listcity.get(i));
	}
	
	g.set_x_labels(labels);
	g.set_x_label_style("12", "#006699", 0, 1, "");
	g.set_x_axis_steps(1);
	g.set_x_tick_size(5);
	g.set_bg_colour("#eaf7fc");

	g.set_y_right_label_style("12", "#006699");	
	g.attach_to_y_right_axis(labels);//添加y右坐标轴
	g.set_y_right_max(100);
	g.set_y_right_min(0);
	g.set_y_max(100);
	g.set_y_min(0);
	//g.set_y_right_max(50);
	//g.set_y_right_min(-50);
	g.y_label_steps(10);
	g.set_tool_tip("#val#<br>");
%>
<%=g.render()%>
</body>
</html>
<%@ include file="../include/jsp/footer.jsp"%>